//引入公共样式
import "./css/whole.css";
import "element-ui/lib/theme-chalk/index.css";

//引入公共框架组件
import Vue from "vue";
import Vuex from 'vuex';
import VueRouter from "vue-router";
import ElementUI from "element-ui";
import Echarts from "echarts";
import Axios from "./js/axios.js";
import Store from "./js/store.js";

//引入创建的路由列表
import Routes from "./js/routes";

//引入路由容器
import App from "./App.vue";

Vue.use(VueRouter);
Vue.use(ElementUI);
Vue.use(Echarts);
Vue.use(Vuex);
Vue.prototype.$axios = Axios;
Vue.prototype.$echarts = Echarts;
// 将时间戳转日期格式的过滤器
Vue.filter('dateFormat', (dataStr) => {
    var time = new Date(dataStr*1000);
  
    function timeAdd0(str) {
      if (str < 10) {
        str = '0' + str;
      }
      return str
    }
    var y = time.getFullYear();
    var m = time.getMonth() + 1;
    var d = time.getDate();
    var h = time.getHours();
    var mm = time.getMinutes();
    var s = time.getSeconds();
    return y + '-' + timeAdd0(m) + '-' + timeAdd0(d) + ' ' + timeAdd0(h) + ':' + timeAdd0(mm) + ':' + timeAdd0(s);
});

new Vue({
  el: "#app",
  router: new VueRouter({
    routes: Routes,
    mode: "history"
  }),
  store: new Vuex.Store(Store),
  render: create => create(App)
});
